<?xml version="1.0" encoding="UTF-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>CLASSE RICA</Title>
      <Author>LSANTANA</Author>
      <Description>Define uma interface nos moldes do framework Dao do siga2.</Description>
      <Shortcut>clRic</Shortcut>
    </Header>
    <Snippet>
      <Declarations>
        <Object>
          <ID>Classe_De_Dominio</ID>
          <Type>Object</Type>
          <ToolTip>Digite a classe de dominio?</ToolTip>
          <Default>[Classe_de_Dominio]</Default>
        </Object>
        <Object>
          <ID>NAMESPACE</ID>
          <Type>Object</Type>
          <ToolTip>Namespace e Assembly</ToolTip>
          <Default>[NameSpace]</Default>
        </Object>
      </Declarations>
      <Code Language="VB" Kind="file"><![CDATA[
	  'Digite o NameSpace: $NameSpace$
	  'Digite o nome da Classe de dominio: $Classe_De_Dominio$

'--TESTE:-----------
'    <TestMethod()> _
'    Public Sub Salvar$Classe_De_Dominio$()
'        Dim _$Classe_De_Dominio$ As $Classe_De_Dominio$
'        _$Classe_De_Dominio$ = New $Classe_De_Dominio$
'
'        _$Classe_De_Dominio$.Salvar()
'
'        Assert.IsTrue(_$Classe_De_Dominio$.Id.HasValue)
'    End Sub
<Serializable()> _ 
Public Class $Classe_De_Dominio$
    Inherits BaseDominio

#Region "Negocio"

    Public Sub New()
        MyBase.New()
    End Sub

    Public Overridable Function Buscar(ByVal _id As Long) As $Classe_De_Dominio$
        Return MyBase.$Classe_De_Dominio$Dao.Buscar(_id)
    End Function

    Public Overridable Sub Salvar()
        MyBase.$Classe_De_Dominio$Dao.Salvar(Me)
    End Sub

#End Region
	
End Class


'--BASEDOMINIO:-----------------------------------
    Protected Overridable Property $Classe_De_Dominio$Dao() As I$Classe_De_Dominio$Dao Implements IRepositorio.$Classe_De_Dominio$Dao
        Get
            Return Me.Repositorio.$Classe_De_Dominio$Dao
        End Get
        Set(ByVal value As I$Classe_De_Dominio$Dao)

        End Set
    End Property
	  
'--IREPOSITORIO:----------------------------------
	Property $Classe_De_Dominio$Dao() As I$Classe_De_Dominio$Dao
	
'--REPOSITORIO:-----------------------------------
    Private _$Classe_De_Dominio$Dao As I$Classe_De_Dominio$Dao
    Public Property $Classe_De_Dominio$Dao() As I$Classe_De_Dominio$Dao Implements IRepositorio.$Classe_De_Dominio$Dao
        Get
            Return _$Classe_De_Dominio$Dao
        End Get
        Set(ByVal value As I$Classe_De_Dominio$Dao)
            _$Classe_De_Dominio$Dao = value
        End Set
    End Property

'--INTERFACE DAO:---------------------------------
Imports FrameworkNHibernate.Dal

Public Interface I$Classe_De_Dominio$Dao
    Inherits IGenericDao(Of $Classe_De_Dominio$)

End Interface

'--IMPLEMENTACAO DAO:----------------------------------
Imports NHibernate.Criterion
Imports NHibernate
Imports FrameworkNHibernate
Imports FrameworkNHibernate.Dal

Public Class $Classe_De_Dominio$Dao
    Inherits GenericsNHibernateDao(Of $Classe_De_Dominio$)
    Implements I$Classe_De_Dominio$Dao

End Class

'--HBM:-------------------
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" schema="dbo" namespace="$NameSpace$" assembly="$NameSpace$">
  <class name="$Classe_De_Dominio$" table="$Classe_De_Dominio$" lazy="true">
    <id name="Id" column="Id$Classe_De_Dominio$" unsaved-value="null">
      <generator class="identity" />
    </id>
    <!--

    <property name="Nome" column="Nome" />
    <property name="CPF" column="CPF" />
    
    <bag cascade="none" name="OutrasClasses" table="OutraClasseDo$Classe_De_Dominio$" lazy="true">
      <key column="Id$Classe_De_Dominio$"/>
      <many-to-many column="IdOutraClasse" class="OutraClasse"/>
    </bag>

    <many-to-one name="Cliente" column="IdCliente" not-null="true" class="Cliente" lazy="proxy" />

    <one-to-one name="Rodape" class="$NameSpace$.RodapeContrato,$NameSpace$" cascade="none" property-ref="TemplateContrato" />
     <bag name="Outras" lazy="true" cascade="all-delete-orphan">
        <key column="Id$Classe_De_Dominio$" />
        <one-to-many class="$NameSpace$.OutraClasse, $NameSpace$"/>
      </bag>
	  
	      <property name="Prioridade" column="Prioridade" type="Fgv.Waste.PrioridadeEnvioStringType, Fgv.Waste" />
	  
    <discriminator column="Discriminator" not-null="true" type="System.String"/>
    
    <subclass name="XXX" discriminator-value="XXX" abstract="false">

    </subclass>
    -->
  </class>
</hibernate-mapping>

'--SPRING:-----------
<object id="$Classe_De_Dominio$Dao" type="$NameSpace$.$Classe_De_Dominio$Dao, $NameSpace$" autowire="byType">
</object>

  
]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>